package Servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by liushiyin on 2017/11/15.
 */
public class Translater extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        request.setCharacterEncoding("UTF-8");

        String param=request.getParameter("status");
        if(param!=null){
            switch (param){
                case "personal":
                    request.setAttribute("status","PERSONAL");
                    request.getRequestDispatcher("PersonalIntroduce.jsp").forward(request,response);
                    break;
                case "blog":
                    request.setAttribute("status","BLOG");
                    request.getRequestDispatcher("MyBlog.jsp").forward(request,response);
                    break;
                case "project":
                    request.setAttribute("status","PROJECT");
                    request.getRequestDispatcher("MyProject.jsp").forward(request,response);
                    break;
                default:
                    break;
            }
        }
    }
}
